export {};

Component({
  /**
   * 组件的一些选项
   */
  options: {
    addGlobalClass: true,
    multipleSlots: true
  },
  /**
   * 组件的对外属性
   */
  properties: {
    bgColor: {
        type: String,
        value: "bg-gradual-blue" 
      }, 
      isCustom: {
        type:Boolean,
        value: false
      },
      isHome: {
        type:Boolean,
        optionalTypes: [String],
        value: false
      },
      isBack: {
        type:Boolean,
        optionalTypes: [String],
        value: false
      },
  },

  /**
   * 组件的初始数据
   */

  data: {
    statusBarHeight: undefined as any ,
    customNavbarHeight:undefined as any ,
    menuButtonObject: undefined as any,
    isHome:false,
  },
  /**
   * 组件的方法列表
   */
  lifetimes:{
    async attached(){
      const statusBarHeight = wx.getSystemInfoSync().statusBarHeight;
      const menuButtonObject = wx.getMenuButtonBoundingClientRect();
      const customNavbarHeight = statusBarHeight  + menuButtonObject.height + (menuButtonObject.top - statusBarHeight)*2;      
      this.setData({
        statusBarHeight:statusBarHeight,
        menuButtonObject:menuButtonObject,
        customNavbarHeight:customNavbarHeight,
      })
   }
  },
  methods: {
    BackPage() {
      wx.navigateBack({
        delta: 1
      });
    },
    toHome(){
      wx.switchTab({
        url: '/pages/index/index',
      })
    }
  },

})
